<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!-- public quote -->
<%@include file="/jsp/comm_css_include.jsp"%>
<link href="${basePath }/css/timeline.css?v=2342" rel="stylesheet">
<!doctype html>
<html>
<head>
<style type="text/css">
li {
	list-style: none;
}
</style>
</head>
<body class="gray-bg">
	<div class="container creditbody">
		<div class="iboxtitle">
			<span><i class="glyphicon glyphicon-map-marker"></i>&nbsp;财务相关>退提车款</span>
		</div>
		<div class="buttonfixed">
			<button type="button" class="btn dpbtn_blue btnaplly"
				id="saveRefundCar">保存提交</button>
		</div>
		<form class="form-horizontal business-form" id="commentForm">
			<div class="business-history">
				<ul>
					<li>【历史退款】</li>
					<li>${history }</li>
				</ul>
			</div>
			<div class="business-man">协议资料</div>
			<%@include file="/jsp/xieyi_zi_liao.jsp"%>
			<c:if test="${prepare_account }">
				<%@include file="/jsp/comm_count_infor.jsp"%>
			</c:if>
			<div class="business-manwife">业务进程</div>
			<div class="business-padding" id="">
				<table class="yw-course">
					<thead>
						<tr>
							<th class="splztab bg-grey">按揭日报表</th>
							<th class="splztab bg-grey">申请垫资
								</li>
							<th class="splztab bg-grey">财务审核1</th>
							<th class="splztab bg-grey">财务审核2</th>
							<th class="splztab bg-grey">财务垫款</th>
							<th class="splztab bg-grey">垫款调整A</th>
							<th class="splztab bg-grey">申请垫款调整Ｂ</th>
							<th class="splztab bg-grey">垫款调整Ｂ审核</th>
							<th class="splztab bg-grey">垫款调整Ｂ</th>
							<th class="splztab bg-green">财务退款</th>
						</tr>
					</thead>
				</table>
			</div>
			<div class="business-manwife">退款信息</div>
			<div class="tche-padding">
				<table cellpadding="0" cellspacing="0" border="0"
					class="buyinfor-table">
					<tr>
						<td align="right" class="td-width"><label
							class="control-label np">退款银行：</label></td>
						<td class="td-width" colspan="4"><mytag:selectTag id="bankRemit" name="bankRemit"
								map="${loanBank }" others="class='select-control' required='required'"
								firstoption="true" /></td>
					</tr>
					<tr>			
						<td align="right"><label class="control-label np">到账时间：</label>
						</td>
						<td><input id="timeArrive" name="timeArrive"
							class="laydate-icon form-control" placeholder="到账时间(必填)" required="required" /></td>
					</tr>
					<tr>
						<td align="right"><label class="control-label np">财务审核人：</label>
						</td>
						<td class="td-width"><mytag:selectTag id="nameAuditor" name="nameAuditor"
								map="${remitFinanceAuditor }" others="class='select-control' required='required'" /></td>
						<td align="right"><label class="control-label np">财务审核时间：</label>
						</td>
						<td><input id="timeAudit" name="timeAudit"
							class="laydate-icon form-control" placeholder="财务审核时间(必填)" required="required" /></td>
					</tr>
				</table>
			</div>
			<!-- 当前经办人 -->
			<%@include file="/jsp/comm_current_person_include.jsp"%>
		</form>
	</div>

	<!-- public quote -->
	<%@include file="/jsp/comm_js_include.jsp"%>
	<!-- summernote -->
	<%@include
		file="/js/common-dpqc/dpqc-summernote/comm_summernote_include.jsp"%>
	<!-- 车品牌/车型/车系选择 -->
	<%-- <%@include file="/jsp/comm_js_carModel_include.jsp"%> --%>

	<!-- layerDate plugin javascript -->
	<script type="text/javascript"
		src="${basePath}/js/plugins/layer/laydate/laydate.js"></script>

	<!--
    	作者：zhangpp
    	时间：2017-04-06
    	描述：js
    -->
	<script type="text/javascript">
	    jQuery(function($) {  
	    	//外部js调用
		    laydate({
		        elem: '#timeArrive', 
		        event: 'focus',
		        istime: true,
		        format: 'YYYY-MM-DD hh:mm'
		    });
		    laydate({
		        elem: '#timeAudit', 
		        max:laydate.now(),
		        event: 'focus' 
		    });
		    
		    $('#saveRefundCar').click(function(){
		    	var validstatus = $("#commentForm").valid();
		    	if(!validstatus) {
		    	   layer.msg("有验证未通过，请仔细检查！", {icon: 5});
		    	   return;
		    	}
		    	save();
		    });
		    
	    });
	    
		//确认退提车款
		function save(){
			layer.confirm('确认退提车款吗 ?操作人：<span style="color:#BD1723;">${current_user_key.uname}</span>', {
				  title:'保存提交',
				  btn: ['确认','返回修改'] //按钮
				}, function(){
					layer.closeAll();
						var data = {};
						data.busiId = $('#busiId').val();
						data.cusId = $('#customerId').val();
						data.bankRemit = $('#bankRemit').val();
						data.timeArrive = $('#timeArrive').val();
						data.nameAuditor = $('#nameAuditor').val();
						data.timeAudit = $('#timeAudit').val();
						
						$.dpAjax({
			        		show:true,
			 	    		url:'${basePath}/CwRefundCarController/refundCar',
			 	    		data:data,
			     			success: function(datas){
				     			  if(datas.flag == "100100")
			 					  {
			     					 layer.msg("退提车款登记成功！", {icon: 6,time:3000});
				     				 setTimeout(function(){
				     					location.href='${basePath}/web/system/cw/refundCar.jsp'; 
				     				 },3000);
			 						 return;
			 					  }
			 					  if(datas.flag == "100200")
			 	                  {
			 						  $.fn.showDatas({"datas":datas});
			 	                	  return;
			 	                  }
			 					  layer.msg(datas.message, {icon: 2});
			                 }
			 	    	});
				}, function(){
					layer.closeAll();
				});
		}
		
		$(function(){
	        $("#commentForm").validate({
	            showErrors: function (errorMap, errorList) {
	                $.each(errorList, function (i, v) {
	                    layer.tips(v.message, v.element, { time: 1500 });
	                    return false;
	                });  
	            },
	            /* 失去焦点时验证 */
	            onfocusout: function(element) { $(element).valid(); },
	            /*  键盘抬起不验证 */
	            onkeyup:false,
	        });
		});
    </script>
</body>
</html>
